package com.system.integralserver.bus;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * Created with IntelliJ IDEA.
 * User: ll
 * Date: 2020/07/09 11:11
 * Description:
 * Version: V1.0
 */
@Component
public class TestReceiver {
    @Autowired
    private AmqpTemplate amqpTemplate;

//    @RabbitListener(queues = "integralserver.test")
    public void consume(Message msg) {
        System.out.println("收到的msg：" + msg);
        System.out.println("收到的body:" + new String(msg.getBody()));
//        String receivedExchange = msg.getMessageProperties().getReceivedExchange();
//        String receivedRoutingKey = msg.getMessageProperties().getReceivedRoutingKey();
//        String replyTo = msg.getMessageProperties().getReplyTo();
//        rabbitTemplate.convertAndSend("replyExchange", replyTo, "消费端的回复");
    }

}
